Option Strict On
Option Explicit On 

Public Class USection
    Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents lblHeight As System.Windows.Forms.Label
    Friend WithEvents nudHeight As System.Windows.Forms.NumericUpDown
    Friend WithEvents uclBackColor As Avand.UColor
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(USection))
        Me.lblHeight = New System.Windows.Forms.Label
        Me.nudHeight = New System.Windows.Forms.NumericUpDown
        Me.uclBackColor = New Avand.UColor
        CType(Me.nudHeight, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'lblHeight
        '
        Me.lblHeight.AccessibleDescription = resources.GetString("lblHeight.AccessibleDescription")
        Me.lblHeight.AccessibleName = resources.GetString("lblHeight.AccessibleName")
        Me.lblHeight.Anchor = CType(resources.GetObject("lblHeight.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.lblHeight.AutoSize = CType(resources.GetObject("lblHeight.AutoSize"), Boolean)
        Me.lblHeight.Dock = CType(resources.GetObject("lblHeight.Dock"), System.Windows.Forms.DockStyle)
        Me.lblHeight.Enabled = CType(resources.GetObject("lblHeight.Enabled"), Boolean)
        Me.lblHeight.Font = CType(resources.GetObject("lblHeight.Font"), System.Drawing.Font)
        Me.lblHeight.Image = CType(resources.GetObject("lblHeight.Image"), System.Drawing.Image)
        Me.lblHeight.ImageAlign = CType(resources.GetObject("lblHeight.ImageAlign"), System.Drawing.ContentAlignment)
        Me.lblHeight.ImageIndex = CType(resources.GetObject("lblHeight.ImageIndex"), Integer)
        Me.lblHeight.ImeMode = CType(resources.GetObject("lblHeight.ImeMode"), System.Windows.Forms.ImeMode)
        Me.lblHeight.Location = CType(resources.GetObject("lblHeight.Location"), System.Drawing.Point)
        Me.lblHeight.Name = "lblHeight"
        Me.lblHeight.RightToLeft = CType(resources.GetObject("lblHeight.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.lblHeight.Size = CType(resources.GetObject("lblHeight.Size"), System.Drawing.Size)
        Me.lblHeight.TabIndex = CType(resources.GetObject("lblHeight.TabIndex"), Integer)
        Me.lblHeight.Text = resources.GetString("lblHeight.Text")
        Me.lblHeight.TextAlign = CType(resources.GetObject("lblHeight.TextAlign"), System.Drawing.ContentAlignment)
        Me.lblHeight.Visible = CType(resources.GetObject("lblHeight.Visible"), Boolean)
        '
        'nudHeight
        '
        Me.nudHeight.AccessibleDescription = resources.GetString("nudHeight.AccessibleDescription")
        Me.nudHeight.AccessibleName = resources.GetString("nudHeight.AccessibleName")
        Me.nudHeight.Anchor = CType(resources.GetObject("nudHeight.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.nudHeight.Dock = CType(resources.GetObject("nudHeight.Dock"), System.Windows.Forms.DockStyle)
        Me.nudHeight.Enabled = CType(resources.GetObject("nudHeight.Enabled"), Boolean)
        Me.nudHeight.Font = CType(resources.GetObject("nudHeight.Font"), System.Drawing.Font)
        Me.nudHeight.ImeMode = CType(resources.GetObject("nudHeight.ImeMode"), System.Windows.Forms.ImeMode)
        Me.nudHeight.Location = CType(resources.GetObject("nudHeight.Location"), System.Drawing.Point)
        Me.nudHeight.Maximum = New Decimal(New Integer() {10000, 0, 0, 0})
        Me.nudHeight.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
        Me.nudHeight.Name = "nudHeight"
        Me.nudHeight.RightToLeft = CType(resources.GetObject("nudHeight.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.nudHeight.Size = CType(resources.GetObject("nudHeight.Size"), System.Drawing.Size)
        Me.nudHeight.TabIndex = CType(resources.GetObject("nudHeight.TabIndex"), Integer)
        Me.nudHeight.TextAlign = CType(resources.GetObject("nudHeight.TextAlign"), System.Windows.Forms.HorizontalAlignment)
        Me.nudHeight.ThousandsSeparator = CType(resources.GetObject("nudHeight.ThousandsSeparator"), Boolean)
        Me.nudHeight.UpDownAlign = CType(resources.GetObject("nudHeight.UpDownAlign"), System.Windows.Forms.LeftRightAlignment)
        Me.nudHeight.Value = New Decimal(New Integer() {1, 0, 0, 0})
        Me.nudHeight.Visible = CType(resources.GetObject("nudHeight.Visible"), Boolean)
        '
        'uclBackColor
        '
        Me.uclBackColor.AccessibleDescription = resources.GetString("uclBackColor.AccessibleDescription")
        Me.uclBackColor.AccessibleName = resources.GetString("uclBackColor.AccessibleName")
        Me.uclBackColor.Anchor = CType(resources.GetObject("uclBackColor.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.uclBackColor.AutoScroll = CType(resources.GetObject("uclBackColor.AutoScroll"), Boolean)
        Me.uclBackColor.AutoScrollMargin = CType(resources.GetObject("uclBackColor.AutoScrollMargin"), System.Drawing.Size)
        Me.uclBackColor.AutoScrollMinSize = CType(resources.GetObject("uclBackColor.AutoScrollMinSize"), System.Drawing.Size)
        Me.uclBackColor.BackgroundImage = CType(resources.GetObject("uclBackColor.BackgroundImage"), System.Drawing.Image)
        Me.uclBackColor.Caption = resources.GetString("uclBackColor.Caption")
        Me.uclBackColor.Color = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(0, Byte), CType(0, Byte))
        Me.uclBackColor.Dock = CType(resources.GetObject("uclBackColor.Dock"), System.Windows.Forms.DockStyle)
        Me.uclBackColor.Enabled = CType(resources.GetObject("uclBackColor.Enabled"), Boolean)
        Me.uclBackColor.Font = CType(resources.GetObject("uclBackColor.Font"), System.Drawing.Font)
        Me.uclBackColor.ImeMode = CType(resources.GetObject("uclBackColor.ImeMode"), System.Windows.Forms.ImeMode)
        Me.uclBackColor.Location = CType(resources.GetObject("uclBackColor.Location"), System.Drawing.Point)
        Me.uclBackColor.Name = "uclBackColor"
        Me.uclBackColor.RightToLeft = CType(resources.GetObject("uclBackColor.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.uclBackColor.Size = CType(resources.GetObject("uclBackColor.Size"), System.Drawing.Size)
        Me.uclBackColor.TabIndex = CType(resources.GetObject("uclBackColor.TabIndex"), Integer)
        Me.uclBackColor.Visible = CType(resources.GetObject("uclBackColor.Visible"), Boolean)
        '
        'USection
        '
        Me.AccessibleDescription = resources.GetString("$this.AccessibleDescription")
        Me.AccessibleName = resources.GetString("$this.AccessibleName")
        Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean)
        Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size)
        Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.Controls.Add(Me.uclBackColor)
        Me.Controls.Add(Me.nudHeight)
        Me.Controls.Add(Me.lblHeight)
        Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean)
        Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font)
        Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode)
        Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point)
        Me.Name = "USection"
        Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.Size = CType(resources.GetObject("$this.Size"), System.Drawing.Size)
        CType(Me.nudHeight, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public Event ValueChanged As EventHandler

    Private Sub Usection_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler nudHeight.ValueChanged, AddressOf OnValueChanged : AddHandler nudHeight.TextChanged, AddressOf OnValueChanged
        AddHandler uclBackColor.ValueChanged, AddressOf OnValueChanged
    End Sub

    Protected Sub OnValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        RaiseEvent ValueChanged(Me, New EventArgs)
    End Sub

    Public Sub Read(ByVal section As Model10.Section)
        nudHeight.Value = section.Height
        uclBackColor.Color = section.BackColor
    End Sub
    Public Sub Write(ByVal section As Model10.Section)
        section.Height = CInt(nudHeight.Value)
        section.BackColor = uclBackColor.Color
    End Sub
End Class